/**
 * @param {number[][]} matrix
 * @param {number} target
 * @return {boolean}
 */
var searchMatrix = function (matrix, target) {
  const m = matrix.length,
    n = matrix[0].length;
    console.log(m,n)
  let i = 0,
    j = n-1;
  while (i < m && j >= 0) {
    let val = matrix[i][j];
    if (val < target) {
      i++;
    } else if (val > target) {
      j--;
    } else {
      return true;
    }
  }
  return false;
};


console.log(searchMatrix([[1,3,5,7],[10,11,16,20],[23,30,34,60]],13))